package day02;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

// @WebServlet(value = "/testServlet",loadOnStartup = 0)
// public class TestServlet implements Servlet {
public class TestServlet extends HttpServlet {


    private ServletConfig config;

    @Override
    public void init(ServletConfig config) {
        System.out.println("TestServlet.init(ServletConfig)");
        this.config = config;
        init();

    }

    @Override
    public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
        System.out.println("TestServlet.service(ServletRequest,ServletResponse)");
        service((HttpServletRequest) request, (HttpServletResponse) response);
    }


    public void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) {
        System.out.println("TestServlet.service(HttpServletRequest,HttpServletResponse)");
    }


    @Override
    public void destroy() {
        System.out.println("TestServlet.destroy()");
    }


    public void init() {
    }


    @Override
    public ServletConfig getServletConfig() {
        return config;
    }


    @Override
    public String getServletInfo() {
        return null;
    }


}
